/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kai.zhouzhi.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "article", catalog = "nature", schema = "")
@NamedQueries({
    @NamedQuery(name = "Article.findAll", query = "SELECT a FROM Article a"),
    @NamedQuery(name = "Article.findByArticleId", query = "SELECT a FROM Article a WHERE a.articleId = :articleId"),
    @NamedQuery(name = "Article.findByArticleTitle", query = "SELECT a FROM Article a WHERE a.articleTitle = :articleTitle"),
    @NamedQuery(name = "Article.findByArticlePhoto", query = "SELECT a FROM Article a WHERE a.articlePhoto = :articlePhoto"),
    @NamedQuery(name = "Article.findByArticleFile", query = "SELECT a FROM Article a WHERE a.articleFile = :articleFile"),
    @NamedQuery(name = "Article.findByArticleContent", query = "SELECT a FROM Article a WHERE a.articleContent = :articleContent"),
    @NamedQuery(name = "Article.findByArticleDepart", query = "SELECT a FROM Article a WHERE a.articleDepart = :articleDepart"),
    @NamedQuery(name = "Article.findByArticleAuthor", query = "SELECT a FROM Article a WHERE a.articleAuthor = :articleAuthor"),
    @NamedQuery(name = "Article.findByArticleDate", query = "SELECT a FROM Article a WHERE a.articleDate = :articleDate"),
    @NamedQuery(name = "Article.findByArticleViewNum", query = "SELECT a FROM Article a WHERE a.articleViewNum = :articleViewNum")})
public class Article implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "article_id", nullable = false)
    private Integer articleId;
    @Basic(optional = false)
    @Column(name = "article_title", nullable = false, length = 100)
    private String articleTitle;
    @Column(name = "article_photo", length = 50)
    private String articlePhoto;
    @Column(name = "article_file", length = 50)
    private String articleFile;
    @Basic(optional = false)
    @Column(name = "article_content", nullable = false, length = 1000)
    private String articleContent;
    @Basic(optional = false)
    @Column(name = "article_depart", nullable = false, length = 50)
    private String articleDepart;
    @Basic(optional = false)
    @Column(name = "article_author", nullable = false, length = 20)
    private String articleAuthor;
    @Basic(optional = false)
    @Column(name = "article_date", nullable = false, length = 20)
    private String articleDate;
    @Basic(optional = false)
    @Column(name = "article_view_num", nullable = false)
    private int articleViewNum;
    @JoinColumn(name = "article_cate_id", referencedColumnName = "article_cate_id", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private ArticleCate articleCateId;

    public Article() {
    }

    public Article(Integer articleId) {
        this.articleId = articleId;
    }

    public Article(Integer articleId, String articleTitle, String articleContent, String articleDepart, String articleAuthor, String articleDate, int articleViewNum) {
        this.articleId = articleId;
        this.articleTitle = articleTitle;
        this.articleContent = articleContent;
        this.articleDepart = articleDepart;
        this.articleAuthor = articleAuthor;
        this.articleDate = articleDate;
        this.articleViewNum = articleViewNum;
    }

    public Integer getArticleId() {
        return articleId;
    }

    public void setArticleId(Integer articleId) {
        this.articleId = articleId;
    }

    public String getArticleTitle() {
        return articleTitle;
    }

    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }

    public String getArticlePhoto() {
        return articlePhoto;
    }

    public void setArticlePhoto(String articlePhoto) {
        this.articlePhoto = articlePhoto;
    }

    public String getArticleFile() {
        return articleFile;
    }

    public void setArticleFile(String articleFile) {
        this.articleFile = articleFile;
    }

    public String getArticleContent() {
        return articleContent;
    }

    public void setArticleContent(String articleContent) {
        this.articleContent = articleContent;
    }

    public String getArticleDepart() {
        return articleDepart;
    }

    public void setArticleDepart(String articleDepart) {
        this.articleDepart = articleDepart;
    }

    public String getArticleAuthor() {
        return articleAuthor;
    }

    public void setArticleAuthor(String articleAuthor) {
        this.articleAuthor = articleAuthor;
    }

    public String getArticleDate() {
        return articleDate;
    }

    public void setArticleDate(String articleDate) {
        this.articleDate = articleDate;
    }

    public int getArticleViewNum() {
        return articleViewNum;
    }

    public void setArticleViewNum(int articleViewNum) {
        this.articleViewNum = articleViewNum;
    }

    public ArticleCate getArticleCateId() {
        return articleCateId;
    }

    public void setArticleCateId(ArticleCate articleCateId) {
        this.articleCateId = articleCateId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (articleId != null ? articleId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Article)) {
            return false;
        }
        Article other = (Article) object;
        if ((this.articleId == null && other.articleId != null) || (this.articleId != null && !this.articleId.equals(other.articleId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kai.zhouzhi.entity.Article[articleId=" + articleId + "]";
    }

}
